#ifndef _GOVT_SKILL_HPP_
#define _GOVT_SKILL_HPP_
/*******************************************************************************
 ** Government Sanctioned Espionage RPG                                       **
 ** http://www.government-sanctioned.us/                                      **
 **===========================================================================**
 ** Name: skill.hpp                                                           **
 ** Description: Skills and stuff!                                            **
 **                                                                           **
 ** Open Source Initiative (OSI) Approved License                             **
 **                                                                           **
 ** The contents of this file are subject to the terms of the                 **
 ** Common Development and Distribution License, Version 1.0 only             **
 ** (the "License").  You may not use this file except in compliance          **
 ** with the License.                                                         **
 **                                                                           **
 ** You can find a copy of the license in the LICENSE file within             **
 ** this distribution or at $WIKI/display/GOVT/License-software.              **
 ** Software distributed under the License is distributed on an "AS IS"       **
 ** basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.           **
 ** See the License for the specific language governing permissions           **
 ** and limitations under the License.                                        **
 **                                                                           **
 ** When distributing Covered Code, include this CDDL header in each          **
 ** file and include the License file at $GAME_DIR/LICENSE.                   **
 ** If applicable, add the following below this header, with the indicated    **
 ** fields enclosed by brackets "[]" replaced with your own identifying       **
 ** information: Portions Copyright [yyyy] [name of copyright owner]          **
 **                                                                           **
 ** Copyright (c) 2009-2012  Barry Gian James <gian@gamingods.net>            **
 ** All rights reserved.                                                      **
 ******************************************************************************/

// Created on March 17, 2010, 12:29 AM
// Modified $Date$ by $Author$
// Portions Copyright 2012 Open Design Strategies, LLC.
// All rights reserved.

#define Skill_hpp_ID   "$Id$"

#include <string>
#include <map>
#include <odb/core.hxx>
#include "action.hpp"

//! @class SkillFamily
//! @brief The skill family a skill belongs to
#pragma db object table("skill_family")
class SkillFamily
{
public:
	SkillFamily();

	const entity_t	ID() const { return id_; }
	const std::string 	Name()const  { return name_; }
	const std::string		Desc() const { return desc_; }
	void			Name(const std::string & n) { name_ = n; }
	void			Desc(const std::string & d) { desc_ = d; }
private:
	friend class odb::access;
	#pragma db id auto
	entity_t	id_;
#pragma db type ("VARCHAR(45)")
	std::string	name_;
	std::string	desc_;
};
//! @class SkillTag
//! @brief Tags on skills describing alternate requirements for the check
#pragma db object table("skill_tags")
struct SkillTag
{
	#pragma db id auto
	entity_t	id_;
#pragma db type ("VARCHAR(5)")
	std::string	abbr_;
#pragma db type ("VARCHAR(32)")
	std::string	name_;
};

//! @class SkillRankNames
//! @brief Categorical skill names for rank numbers
#pragma db object table("skill_rank_names")
struct SkillRankName
{
#pragma db id auto
	entity_t	id_;
#pragma db type ("VARCHAR(32)")
	std::string	name_;
};

//typedef pair<std::wstring,SkillCheck*>   skill_t;
//! @class Skill
//! @brief The basic/primary skill DB class
#pragma db object table("skill_type")
class SkillTemplate {
public:
	SkillTemplate() {}
    explicit SkillTemplate(const std::string & n) : name_(n) { }
    SkillTemplate(const SkillTemplate& orig);

    // Getters
    const entity_t		ID() const { return id_; }
    const std::string &	Name() const { return name_; }
    const entity_t		Attr() const { return ability_; }
    const entity_t		CounterBonus() const { return idcounter_bonus_; }
    const bool			Untrained() const { return untrained_; }
    const ActionTime 	Action() const { return action_; }
    const std::string &	Special() const { return special_; }
    const std::string &	Desc() const { return desc_; }
    const entity_t	Family() const { return family_; }

    // Setters
    void	Name(const std::string & n) { name_ = n; }
    void	Attr(const entity_t a) { ability_ = a; }
    void	CounterBonus(const entity_t c) { idcounter_bonus_ = c; }
    void	Untrained(bool b) { untrained_ = b; }
    void	Action(const ActionTime a) { action_ = a; }
    void	Special(const std::string & s) { special_= s; }
    void	Desc(const std::string & d) { desc_ = d; }
    void	Family(const entity_t f) { family_ = f; }
    
private:
    friend class odb::access;

	#pragma db id auto
    entity_t		id_;
    std::string    	name_;
    entity_t		ability_;
    entity_t		idcounter_bonus_;
    bool			untrained_;
    ActionTime		action_;
    std::string		special_;	//!< if action = 'special' this is the time
    std::string		desc_;
    entity_t		family_;
//    SkillFamily		family_;
};

// This structure simply holds/references the actual skills a char has
#pragma db object table("character_skills")
struct Skills
{
#pragma db id auto
	entity_t	id_;
	entity_t	idchar_;
	entity_t	idskill_;
	ushort		rank;
	bool		class_skill_;	// is this a class skill? is this the right place for this?
};

//! @class SecondarySkill
//! @brief Represents the secondary skills for characters in the DB
#pragma db object table("skill_type_secondary")
class SecondarySkillTemplate
{
public:
	SecondarySkillTemplate() { id_ = 0; }
	SecondarySkillTemplate(const std::string & n, const entity_t a) : name_(n), attr_(a) { id_ = 0; }
	SecondarySkillTemplate(const SecondarySkillTemplate &);
	SecondarySkillTemplate & operator = (const SecondarySkillTemplate &);

	// Getters
	const std::string	& Name() const { return name_; }
	const std::string	& Desc() const { return desc_; }
	const entity_t Attr() const { return attr_; }
	const entity_t ID() const { return id_; }

	// Setters
	void	Name(const std::string & n) { name_ = n; }
	void	Desc(const std::string & d) { desc_ = d; }
	void	Attr(const entity_t a) { attr_ = a; }

private:
	friend class odb::access;
	#pragma db id auto
	entity_t	id_;
	std::string	name_;
	std::string	desc_;
	entity_t	attr_;
};

//! @class CSecondarySkill
//! @brief What each character references for secondary skills
#pragma db object table("character_skills_secondary")
struct SecondarySkill
{
#pragma db id auto
	entity_t	id_;
	entity_t	idchar_;
	entity_t	idsecondary_skill_;
	ushort		rank_;
	ushort		attr_bonus_;
};

#endif	/* _GOVT_SKILL_HPP_ */

